const path=require('path');
const fs=require('fs');
const child_process = require('child_process');
module.exports=new class{
    constructor(){

    }

    start(){
        let taskPath = __dirname;
        let dir = fs.readdirSync(taskPath);
        dir.forEach(item => {
            if (item.indexOf('.') < 0 && item.indexOf('index.js')<0) {
                let taskFilePath = path.join(taskPath, item, 'main.js');
                 child_process.fork(taskFilePath,{
                    env:{NODE_ENV:process.env.NODE_ENV}
                });

            }
        })
    }
};
